package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.dao.VillageUserDao;
import io.renren.dto.VillageUserDTO;
import io.renren.entity.VillageUserEntity;
import io.renren.service.VillageUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 用户
 *
 * @author liuyujun 384880231@qq.com
 * @since 3.0 2022-01-13
 */
@Service
public class VillageUserServiceImpl extends CrudServiceImpl<VillageUserDao, VillageUserEntity, VillageUserDTO> implements VillageUserService {

    @Override
    public QueryWrapper<VillageUserEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<VillageUserEntity> wrapper = new QueryWrapper<>();

        String phone = (String)params.get("phone");
        wrapper.like(StringUtils.isNotBlank(phone), "phone", phone);
        String email = (String)params.get("email");
        wrapper.like(StringUtils.isNotBlank(email), "email", email);
        String idnum = (String)params.get("idnum");
        wrapper.like(StringUtils.isNotBlank(idnum), "idNum", idnum);

        return wrapper;
    }


}